moduleName='Module-0'
watchName='CargoBkgDataSource'
connPoolName='CargoBkgDataSource'
serverName='afls_bkg1'

connect('wladmin', 'weblogic', 'cgappt41.qcorpaa.aa.com:7005')
edit()
startEdit()


try:
    cd('/WLDFSystemResources/' + moduleName + '/WLDFResource/' + moduleName + '/WatchNotification/' + moduleName)
    cmo.createWatch(watchName)
    cd('/WLDFSystemResources/' + moduleName + '/WLDFResource/' + moduleName + '/WatchNotification/' + moduleName + '/Watches/' + watchName)
    cmo.setRuleType('Harvester')
    cmo.setEnabled(true)
    cmo.setRuleExpression('(${ServerRuntime//[weblogic.management.runtime.JDBCConnectionPoolRuntimeMBean]com.bea:Name='+connPoolName+',ServerRuntime=' + serverName + ',Type=JDBCConnectionPoolRuntime//State} != \'RUNNING\')')
    cmo.setAlarmType(None)
    activate()
except:
    undo('true', 'y')
    